<%--
 *  File:    OrgCopySummary.jsp
 *  @Author: Kent Zhong 
 *  Date:    3/3/2005 3:41PM
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<%
  	Category cat = Category.getInstance("jsp.OrgCopySummary");  
%>

<%
	String strModuleName = "IMG";
	String strTableName = "ovorgcopy";
	String privilegeCode = "Z0821";
  	
  	
%>


<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>OrgCopySummary</title>
<PageFlow:CheckPageFlow pageName="orgcopysummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<script language="JavaScript" src="../js/SummaryDivision.js"></script>
<%@include file="/inc/SumDiv.inc"%>
<script>
function page_summary(actionvalue,orderbyname)
{
	  var editform = summaryPrepare(thisform,actionvalue,orderbyname);
	  editform.action = "OrgCopySummary.jsp?<%= OvalTools.randomURL() %>";
	  editform.target = "_self";
	  isRunning = true;
	  editform.submit();  
}
function page_radiotrue(obj,id,status)
{
  radiotrue(obj);
  thisform.orgcopyid.value =id;
  thisform.status.value =status;
}
function page_info(id)
{
  if(!isEmpty(id) && id!=-1)
  {
    self.location.href="OrgCopyInfoFrm.jsp?<%= OvalTools.randomURL() %>&orgcopyid="+id;
  }
}
function page_new()
{
  self.location.href="OrgCopyFrm.jsp?<%= OvalTools.randomURL() %>&isnew=Y";
}
function page_edit()
{
  var id=thisform.orgcopyid.value;
  if(isEmpty(id) || id =='-1')
  {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  } 
  if(thisform.status.value!='10')
  {
    alert('<%= message.getMessage("CAN_NOT_EDIT_IT")%>');
  	return;
  }
   
  self.location.href="OrgCopyFrm.jsp?<%= OvalTools.randomURL() %>&orgcopyid="+id;
}
function page_delete()
{
  var id=thisform.orgcopyid.value;
  if(isEmpty(id) || id =='-1')
  {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  } 
  if(thisform.status.value!='10')
  {
    alert('<%= message.getMessage("CAN_NOT_DEL_IT")%>');
  	return;
  }
  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
  if(!flag)
    return;
  thisform.actionname.value = "delete";
  thisform.target = "_self";
  isRunning = true;
  thisform.submit();
}
function page_deletefinished()
{
<%if(privilegeSet != null && privilegeSet.contains("Z082101")){%>
  var id=thisform.orgcopyid.value;
  if(isEmpty(id) || id =='-1')
  {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  } 
  if(thisform.status.value!='80')
  {
    alert('<%= message.getMessage("CAN_NOT_DEL_IT")%>');
  	return;
  }
  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
  if(!flag)
    return;
  thisform.actionname.value = "deletefinish";
  thisform.target = "_self";
  isRunning = true;
  thisform.submit();
<%}%>
}
</script>
</head>
<body>
<form name="thisform" method="post" action="../Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="orgcopysummary">
    <input type="hidden" name="actionname">
<%@ include file="/inc/PageLocation.inc" %>
  <table width="100%" cellspacing="0" border="0" cellpadding="0">
    <tr> 
      <td> 
        <table width="100%" border="0" cellspacing="0">
          <%@ include file="/inc/SummarySearch.inc" %>
        </table>
        <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          <tr class="deepblue-left"> 
            <td width="27" class="title_center">&nbsp;</td>
            <td width="100" class="title_center"><a href="javascript:page_summary('orderby','orgcode')"><%=label.getLabelName("L_OrgCode")%></a></td>
            <td class="title_center"><a href="javascript:page_summary('orderby','orgname')"><%=label.getLabelName("L_OrgName")%></a></td>
            <td class="title_center" width="100"><a href="javascript:page_summary('orderby','orgtypename')"><%=label.getLabelName("L_OrgType")%></a></td>
            <td class="title_center" width="90"><a href="javascript:page_summary('orderby','copydate')"><%=label.getLabelName("L_CopyDate")%></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','makername')"><%=label.getLabelName("L_Operater")%></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','statusname')"><%=label.getLabelName("L_Status")%></a></td>
          </tr>
          <%
            Vector orgcopies=(Vector)pageContext.getAttribute("orgcopies");
            if(orgcopies==null)
              orgcopies=new Vector();
            int i=0;
            boolean bHasChecked=false;
            Integer nDefaultId=new Integer(-1);
            Integer nDefaultStatus=new Integer(-1);
          %>
          <logic:iterate id="oneorgcopy" collection="<%= orgcopies %>" indexId="idx"> 
          <%
	        	  HashMap tempMap = (HashMap)pageContext.getAttribute("oneorgcopy");
	            String strIsChecked = "";
	            String strClassType="";
	            if(i%2 == 1)
	            {
	              	strClassType = "td-listrom";
	            }
	            else
	            {
	              	strClassType = "";
	            }
	            if(!bHasChecked)
	            {
	            	  strIsChecked = "Checked";
	              	bHasChecked = true;
	              	nDefaultId = (Integer)(tempMap.get("orgcopyid"));
	              	nDefaultStatus = (Integer)(tempMap.get("status"));
	            }
	            i++;
	        %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:page_radiotrue('orgcopyids<%=JspHelper.filterNull(idx)%>','<custom:write name="oneorgcopy" property="orgcopyid"/>','<custom:write name="oneorgcopy" property="status"/>');" class="<%=JspHelper.filterNull(strClassType)%>"> 
            <td> 
              <input id="orgcopyids<%=JspHelper.filterNull(idx)%>" type="radio" name="orgcopyids" value="<custom:write name="oneorgcopy" property="orgcopyid"/>" class="normalradio" <%=JspHelper.filterNull(strIsChecked)%>>
            </td>
            <td><a href="javascript:page_info('<custom:write name="oneorgcopy" property="orgcopyid"/>');"><custom:write name="oneorgcopy" property="orgcode" nbsp="true"/></a></td>
            <td><custom:write name="oneorgcopy" property="orgname" nbsp="true"/></td>
            <td><custom:write name="oneorgcopy" property="orgtypename" nbsp="true"/></td>
            <td><custom:write name="oneorgcopy" property="copydate" dataType="date" dataFormatName="dateformat" nbsp="true"/></td>
            <td><custom:write name="oneorgcopy" property="makername" nbsp="true"/></td>
            <td><custom:write name="oneorgcopy" property="statusname" nbsp="true"/></td>
          </tr>
          </logic:iterate>
          <%@ include file="/inc/SummaryAction.inc" %>
        </table>
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr>
          		<td class="summary_top" ></td>
        	</tr>
          <tr> 
            <td class="td_center"> 
              <input type="hidden" name="orgcopyid" value="<%=JspHelper.filterNull(nDefaultId)%>"/>
              <input type="hidden" name="status" value="<%=JspHelper.filterNull(nDefaultStatus)%>"/>
              <a onclick="page_new();"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
              <%if(orgcopies.size()>0){%>
              <a onclick="page_edit();"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>
              <a onclick="page_delete();"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
              <%if(privilegeSet != null && privilegeSet.contains("Z082101")){%>
              <a onclick="page_deletefinished();"><custom:button type="1" label="L_DeleteFinishedCopy" imgsrc="cancel.gif" border="0" style="width:80"/></a>
              <%}%>
              <%}%>  
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
</body>
</html>
